using System;
using UnityEngine;
using UnityEngine.UI;

public class MultiImageButton : Button
{
	private Graphic[] m_graphics;

	protected Graphic[] Graphics
	{
		get
		{
			if (m_graphics == null)
			{
				m_graphics = base.transform.GetComponentsInChildren<Graphic>();
			}
			return m_graphics;
		}
	}

	protected override void DoStateTransition(SelectionState state, bool instant)
	{
		Color a;
		switch (state)
		{
			case SelectionState.Normal:
				a = base.colors.normalColor;
				break;
			case SelectionState.Highlighted:
				a = base.colors.highlightedColor;
				break;
			case SelectionState.Pressed:
				a = base.colors.pressedColor;
				break;
			case SelectionState.Disabled:
				a = base.colors.disabledColor;
				break;
			default:
				a = Color.white;
				break;
		}
		if (base.gameObject.activeInHierarchy)
		{
			Transition transition = base.transition;
			if (transition != Transition.ColorTint)
			{
				throw new NotSupportedException();
			}
			ColorTween(a * base.colors.colorMultiplier, instant);
		}
	}

	private void ColorTween(Color targetColor, bool instant)
	{
		if (!(base.targetGraphic == null))
		{
			Graphic[] graphics = Graphics;
			foreach (Graphic graphic in graphics)
			{
				graphic.CrossFadeColor(targetColor, instant ? 0f : base.colors.fadeDuration, ignoreTimeScale: true, useAlpha: true);
			}
		}
	}
}
